package chouJiang;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

/*作业：
抽奖箱1中了  800 100 1000 20 80 10 总额为
抽奖箱2中了  5 300 200 50 550 2 总额为
你们得把总和给我计算出来.
再加上，在此次抽奖过程中，抽奖箱1，产生了最大得金额，1000元
*/


public class Demo {
	public static void main(String[] args) throws Exception, ExecutionException {
		ArrayList<Integer> list=new ArrayList<>();
		Collections.addAll(list, 10,5,20,50,100,200,550,800,2,80,300,1000);
		
		
		MyThread t1=new MyThread(list);
		t1.setName("抽奖箱1");
		t1.start();
		MyThread t2=new MyThread(list);
		t2.setName("抽奖箱2");
		t2.start();
		
		
		//100个抽奖箱   再看
		ChouJiang100 c1 = new ChouJiang100(list);
		FutureTask<ArrayList> f1= new FutureTask<>(c1);
		for (int i = 0; i < 100; i++) {
			Thread x1 = new Thread(f1);
			x1.start();
		}
		ArrayList<Integer> aa = f1.get();
		System.out.println(aa);
	}
}

